package com.zofer.study.strategy.ifelse;

public class DiscountHandlerFactory {

    public double handlerDiscount(double amount){
        System.out.println("原始金额："+amount);
        DiscountHandlerContext context;
        Discount discount;
        if (amount > 1000){
            discount = new MoreThousand();
        }else if(amount <= 1000 && amount >500){
            discount = new MoreFiveHundred();
        }else {
            discount = new MoreZeroHundred();
        }
        context = new DiscountHandlerContext(discount);
        return context.discount(amount);
    }
}
